/*
Disclaimer of Warranty: THE PACKAGE IS PROVIDED
BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS'
AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
THE IMPLIED WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT
ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW.
UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR
CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF
THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


(c) Copyright 2013 Edward Principe
All Rights Reserved

*/
#ifndef TOKEX_H
#define TOKEX_H

#include <Windows.h>
#include <tchar.h>
#include <string>
#include <stdex.h>
#include "tokerr.h"

using namespace std;

///////////////////////////////////////////////////////////
// TokEx: Handles an assembler error
///////////////////////////////////////////////////////////
class TokEx : public StdEx
{
public: // Construction
	explicit TokEx(TokErr err = TERR_NONE, unsigned line = 0, unsigned long col = 0) { PutErr(err, line, col); }

	TokEx(const TokEx& rhs)
	{
		Copy(rhs);
	}

public: // Methods
	void PutErr(TokErr err = TERR_NONE, unsigned long line = 0, unsigned long col = 0); // Assigns an error

public: // Access methods
	unsigned long GetErr() const { return _err; }
	unsigned long GetLine() const { return _line; }
	unsigned long GetCol() const { return _col; }

public: // Operators
	TokEx& operator = (const TokEx& rhs)
	{
		Copy(rhs);
		return *this;
	}

private: // Methods
	void Copy(const TokEx& rhs)
	{
		if (this == &rhs)
			return;

		_err = rhs._err;
		_line = rhs._line;
		_col = rhs._col;

		StdEx::Copy(rhs);
		
	}

private: // Attributes
	TokErr _err; // Error
	unsigned long _line; // Line of error
	unsigned long _col; // Column of error
};
#endif